<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
</head>
<style>
    body,
    html {
        background-color: #fff;
    }

    .placeholder_div {
        background-color: #fbf9f9;
    }

    .patient_info {
        padding: 0 1rem;
        margin-bottom: 0.5rem;
        height: 9rem;
    }

    .title {
        margin: 0.8rem 0;
        font-size: 0.8rem;
        color: #303030;
        border-left: 3px solid #2882e1;
        padding-left: 0.8rem;
        height: 0.8rem;
        line-height: 0.8rem;
    }

    .title span {
        float: right;
        color: #2E8EFF;
        font-size: 0.7rem;
    }

    input {
        display: inline-block;
        border-bottom: 1px dashed #ccc;
        outline: none;
        font-size: 0.7rem !important;
    }

    .info {
        width: 100%;
        /* height: 2rem; */
        font-size: 0.6rem;
        color: #565656;
        margin: 0rem 0 1rem 0;
    }

    .info div {
        width: 25%;
        display: inline-block;
    }

    .info div:first-child {
        width: 45%;
    }

    .info div input {
        width: 50%;
        text-align: center;
    }

    .bingming,
    .bingzheng {
        height: 1.5rem;
        line-height: 1.5rem;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .kaifang {
        padding: 0.5rem 1rem;
        background-color: #fff;
        /* margin-bottom: 0.5rem; */
        /* height: 12.5rem; */
    }

    .kaifang .paifang_tip {
        color: #838383;
        font-size: 0.6rem;
        float: right;
        margin-top: 2.75rem;
    }

    .kaifang .paifang_tip img {
        padding-left: 0.3rem;
        width: 0.75rem;
        height: 0.4rem;
    }

    .pharmacy {
        height: 2rem;
        width: 100%;
        position: relative;
        margin-bottom: 1rem;
    }

    .pharmacy .pharmacy_logo {
        width: 2rem;
        height: 2rem;
    }

    .pharmacy .pharmacy_name {
        position: absolute;
        top: 0.2rem;
        left: 2.5rem;
        color: #303030;
        font-size: 0.6rem;
    }

    .pharmacy .subtitle {
        position: absolute;
        bottom: 0.2rem;
        left: 2.5rem;
        color: #838383;
        font-size: 0.5rem;
    }

    .pharmacy .pharmacy_arrow {
        position: absolute;
        width: 0.4rem;
        height: 0.75rem;
        right: 0;
        top: 0.6rem;
    }

    .RP {

        border-top: 1px solid #efefef;

    }

    .RP .add_btn {
        text-align: center;
        width: 60%;
        height: 2.2rem;
        background-color: #2E8EFF;
        color: #fff;
        font-size: 0.8rem;
        line-height: 2.2rem;
        border-radius: 0.5rem;
        margin: 0 20%;
    }

    .RP_main {
        width: 100%;
        background-color: #fff3f3;
    }

    .RP_main .RP_main_item {
        line-height: 3rem;
        color: #565656;
        font-size: 0.7rem;
        width: 33.3%;
        margin-left: -0.25rem;
        display: inline-block;
        text-align: center;
    }

    .useing {
        height: 7rem;
        padding: 0 1rem;
        margin-bottom: 0.5rem;
        background-color: #fff;
    }

    .useing .useing_method {
        height: 1.7rem;
        line-height: 1.7rem;
        border-bottom: 1px solid #ededed;
        color: #565656;
        font-size: 0.6rem;
    }

    .useing .useing_arrow {
        width: 0.4rem;
        height: 0.7rem;
        float: right;
        margin-top: 0.45rem;
    }

    .useing .useing_method span:nth-child(3) {
        margin-right: 0.5rem;
        float: right;
    }

    .useing .useing_detail {
        margin-top: 1rem;
        font-size: 0.6rem;
        color: #565656;
    }

    .useing .useing_detail input {
        width: 15%;
        text-align: center;
        color: #2780e8;
        font-weight: bold;
    }

    .yizhu {
        background-color: #fff;
        margin: 0.5rem 0;
        font-size: 0.7rem;
    }

    .yizhu input {
        float: right;
        width: 80%;
        /* margin-top: 0.4rem; */
        line-height: 1rem;
    }

    .fanganshezhi {
        padding: 0 1rem;
        background-color: #fff;
        margin-bottom: 0.5rem;
    }

    .fanganshezhi .title {
        font-size: 0.8rem;
    }

    .fanganshezhi .fanganshezhi_item {
        height: 2.1rem;
        border-bottom: 1px solid #f5f5f5;
        line-height: 2rem;
        color: #565656;
        font-size: 0.6rem;
        position: relative;
    }

    .fanganshezhi .fanganshezhi_item .fanganshezhi_arrow {
        position: absolute;
        right: 0;
        width: 0.4rem;
        height: 0.7rem;
        top: 0.85rem;
    }

    .fanganshezhi .fanganshezhi_item .price {
        position: absolute;
        right: 1rem;
        top: 0.25rem;
    }

    .fanganshezhi .fanganshezhi_item .zhenjin {
        position: absolute;
        left: 0;
        top: 0.25rem;
    }

    .fanganshezhi p {
        color: #565656;
        line-height: 1.2rem;
        font-size: 0.5rem;
    }

    .total {
        padding: 0 1rem 1rem 1rem;
        background-color: #fff;
        margin-bottom: 0.5rem;
    }

    .total .item {
        font-size: 0.7rem;
        color: #565656;
        line-height: 1.5rem;
    }

    .total .item span {
        color: #838383;
        float: right;
    }

    .total p {
        color: #565656;
        font-size: 0.5rem;
        margin-top: 0.5rem;
    }

    .total p:first-child {
        font-size: 0.8rem;
    }

    .order_btn {
        margin: 0.8rem auto;
        width: 8rem;
        height: 1.2rem;
        background-color: #294ac2;
        color: #fff;
        font-size: 0.8rem;
        text-align: center;
        border-radius: 1rem;
        line-height: 1.2rem;
    }

    .cover {
        position: fixed;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        left: 0;
        top: 0;
        z-index: 99;
        display: none;

    }

    .clear {
        clear: both;
        height: 0;
        margin: 0;
        padding: 0;
    }

    .show {
        display: block;
    }

    .zhezhao_jixing_div {
        position: fixed;
        bottom: 0;
        left: 0;
        height: 20rem;
        width: 100%;
        background-color: #fff;
        border-radius: 0.5rem 0.5rem 0 0;
        display: none;
        z-index: 999;
    }

    .zhezhao_jixing_div .zhezhao_title {
        height: 2.5rem;
        width: 100%;
        border-bottom: 1px solid #E8E8E8;
        line-height: 2.5rem;
    }

    .zhezhao_jixing_div .zhezhao_title span:first-child {
        color: #565656;
        font-size: 0.7rem;
        float: left;
        margin-left: 0.8rem;
    }

    .zhezhao_jixing_div .zhezhao_title span:last-child {
        color: #2780e8;
        font-size: 0.6rem;
        float: right;
        margin-right: 0.8rem;
    }

    .zhezhao_jixing_div .store-container {
        position: static;
        z-index: 9999;
        width: 100%;
        height: 100%;
        display: block;
    }

    .zhezhao_jixing_div .store-container .select_catalog {
        width: 3.8rem;
        float: left;
        margin: 0;
        height: 100%;
        overflow-y: scroll;
    }

    .zhezhao_jixing_div .store-container .select_catalog div {
        text-align: center;
        width: 100%;
        height: 2.5rem;
        line-height: 1.25rem;
        font-size: 0.7rem;
        background-color: #f9f9f9;
        border-bottom: 1px solid #f3f3f3;
    }

    .zhezhao_jixing_div .store-container .select_catalog div span {
        text-align: center;
        vertical-align: middle;
        width: 2.8rem;
        padding: 0.5rem 0;
        word-wrap: break-word;
    }

    .zhezhao_jixing_div .store-container .catalog-item-container {
        position: static;
        display: block;
        width: 14.82rem;
        float: left;
    }

    .zhezhao_jixing_div .catalog-item-container .tips {
        width: 14.82rem;
        height: 0.8rem;
        background-color: #F9F9F9;
        font-size: 0.7rem;
        color: #565656;
        line-height: 0.8rem;
        padding: 0.5rem 0 0.5rem 0.5rem;
        margin: 0;
        clear: both;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item {
        padding: 0.6rem;
        border: 1px solid #E8E8E8;
        border-radius: 0.5rem;
        height: 100%;
        width: 12.5rem;
        margin: 0.6rem;
        display: block;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .logo {
        width: 2.2rem;
        height: 100%;
        float: left;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .logo img {
        width: 2rem;
        border-radius: 20px;
        object-fit: scale-down;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info {
        float: left;
        display: block;
        color: #303030;
        font-size: 0.7rem;
        width: 10rem;
        height: 100%;
        text-align: left;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .store-name-wrap .yaofang_name {
        float: left;
        width: 6rem;
        text-align: left;
        height: 100%;
        font-size: 0.7rem;
        margin: 0 0.2rem;
        overflow-y: hidden;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .store-name-wrap .openwin {
        float: right;
        color: #2E8EFF;
        width: 2.3rem;
        height: 100%;
        font-size: 0.7rem;
        text-align: center;
        vertical-align: middle;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips {
        width: 100%;
        height: 100%;
        display: inline-block;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .service-tags {
        width: auto;
        height: 100%;
        display: inline-block;
        margin-left: 0.2rem;
        margin-top: 0.2rem;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .service-tags-view {
        width: 100%;
        height: 100%;
        display: inline-block;
        margin-left: 0.2rem;
        margin-top: 0.5rem;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .service-tags-view .tips_daijian {
        font-size: 0.7rem;
        color: #303030;
        font-weight: 1000;
        padding: 0.5rem 0 0.5rem 0;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .tips_item {
        padding: 0.1rem 0.2rem;
        font-size: 0.5rem;
        border: 1px solid #E8E8E8;
        border-radius: 0.2rem;
        display: inline-block;
        float: left;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .service-tags-view .tips_item {
        display: inline-block;
        border: none;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .service-tips .service-tags-view .tips_item span {
        padding: 0.1rem 0 0 0.2rem;
        margin: 0.1rem 0.2rem 0.1rem 0;
        font-size: 0.5rem;
        border: 1px solid #E8E8E8;
        border-radius: 0.2rem;
        float: left;
    }

    .zhezhao_jixing_div .catalog-item-container .select_catalog_item .store-info .price {
        color: #2780e8;
        font-size: 0.7rem;
    }

    .price_zhezhao_main {
        position: fixed;
        width: 16.25rem;
        margin-left: 1.25rem;
        bottom: 7.5rem;
        background-color: #fff;
        display: none;
        z-index: 999;
    }

    .price_zhezhao_main .price_title {
        padding: 1rem 0 1rem 1rem;
        color: #565656;
        font-size: 0.8rem;
    }

    .price_zhezhao_main .price_div {
        padding: 0 1rem;
        overflow-y: auto;
        height: 11rem;
    }

    .price_zhezhao_main .price_div .price_div_item {
        line-height: 2rem;
        color: #565656;
        font-size: 0.7rem;
    }

    .price_zhezhao_main .price_div input {
        line-height: 2rem;
        color: #565656;
        font-size: 0.7rem;
        outline: none;
        border-bottom: none;
    }

    .price_zhezhao_main .btn_div {
        width: 100%;
        height: 3rem;
        line-height: 3rem;
    }

    .price_zhezhao_main .btn_div span {
        width: 49%;
        display: inline-block;
        /* margin-left: -0.25rem; */
        text-align: center;
        color: #565656;
        font-size: 0.7rem;
    }

    .order_success_main {
        width: 14rem;
        height: 17.75rem;
        background: url('../image/award_img.png');
        background-size: 100% 100%;
        margin: 7.5rem 0 0 2.5rem;
        text-align: center;
    }

    .order_success_main .order_success_main_title {
        color: #FDDBAF;
        font-size: 1.2rem;
        padding-top: 3rem;

    }

    .order_success_main .order_success_main_subtitle {
        color: #FDDBAF;
        font-size: 0.6rem;
        margin-top: 2rem;
        line-height: 0.75rem;
    }

    .order_success_main .order_success_main_tips {
        color: #FDDBAF;
        font-size: 0.6rem;
        margin-top: 2rem;
    }

    .order_success_main .close_btn {
        font-size: 0.7rem;
        margin: 4rem 0 0 2.9rem;
        text-align: center;
        color: #2780e8;
        background-color: #fff;
        width: 8.2rem;
        height: 2rem;
        line-height: 2rem;
        border-radius: 0.5rem;
    }

    /* ------------------------- */
    .paifang {
        width: 100%;
    }

    .paifang_tips {
        padding: 0.8rem;
        background-color: #fff;
    }

    .paifang_tips .paifang_tips_title {
        color: #303030;
        font-size: 0.7rem;
    }

    .paifang_tips .paifang_tips_other {
        width: 100%;
        margin-top: 0.75rem;
    }

    .paifang_tips .paifang_tips_other p {
        color: #838383;
        font-size: 0.6rem;
        line-height: 1.2rem;
    }

    .paifang_include {
        width: 100%;
        background-color: #fff;
        text-align: center;
    }

    .paifang_include .paifang_include_title {
        color: #838383;
        font-size: 0.6rem;
        padding: 1rem 0;
    }

    .paifang_include .paifang_include_main {
        height: 3.75rem;
        width: 100%;
    }

    .paifang_include .paifang_include_main .paifang_include_main_left {
        width: 3.75rem;
        height: 3.75rem;
        float: left;
    }

    .paifang_include .paifang_include_main .paifang_include_main_right {
        float: right;
        width: 12.5rem;
        height: 100%;
        /* background-color: skyblue; */
        text-align: left;
    }

    .paifang_include .paifang_include_main .paifang_include_main_right .paifang_include_main_right_title {
        color: #838383;
        font-size: 0.5rem;
    }

    .paifang_include .paifang_include_main .paifang_include_main_right .paifang_include_main_right_info {
        color: #565656;
        font-size: 0.6rem;
    }

    .paifang_include .paifang_include_main .paifang_include_main_right p {
        padding-bottom: 0.25rem;
    }

    .paifang_include .paifang_include_main .tips_div {
        color: #838383;
        font-size: 0.6rem;
        float: right;
        margin-top: -0.8rem;
    }

    .paifang_include .paifang_include_main .tips_div img {
        padding-left: 0.3rem;
        width: 0.75rem;
        height: 0.4rem;
    }

    input {
        font-size: 0.6rem;
    }

    .tab_active {
        color: #fff !important;
        background-color: #2E8EFF !important;
    }

    .topInfo {
        background-color: #2882e1;
        height: 4rem;
        line-height: 4rem;
        font-size: 0.9rem;
        color: #fff;
        padding: 0 0.8rem;
    }

    .topInfo span {
        font-size: 0.7rem;
        margin-left: 0.5rem;
    }

    .topInfo .btn {
        float: right;
        padding: 0.2rem 0.3rem;
        line-height: normal;
        border-radius: 1rem;
        background-color: #acd0f7;
        color: #2882e1;
        font-size: 0.8rem;
        margin-top: 1.3rem;
    }

    .zhenduan {
        font-size: 0.8rem;
    }

    .zhenduan div {
        margin-bottom: 0.5rem;
    }
</style>

<body>
    <div id="app" v-cloak>
        <!-- 患者信息 -->
        <div class="topInfo">
            {{user.realname}}
            <span>
                <span v-if="user.sex == 1">男</span>
                <span v-if="user.sex == 2">女</span>
                <span v-if="user.birthday">{{user.birthday}}出生</span>
            </span>
            <!-- <span class="btn">调用常用方</span> -->
        </div>
        <!-- 开方 -->

        <!-- 患者信息 -->
        <!-- <div class="patient_info">
                <p class="title">患者信息
                    <span class="openwin" data-win="select_hirstory_case_win">调用历史方案</span>
                </p>
                <div class="info">
                    <div class="info_name">姓名: <input type="text" v-model="patient_name"></div>
                    <div class="info_sex">性别: <input type="text" v-model="sex_on" readonly onclick="select_sex()"></div>
                    <div class="info_age">年龄: <input type="Number" v-model="patient_age"></div>
                </div>
                <input class="bingming" type="text" placeholder="辨病，请填写诊断病名" v-model="bingming">
                <input class="bingzheng" type="text" placeholder="辨证，请填写证候名，选填" v-model="bingzheng">
            </div> -->

        <!-- 开方 -->
        <div class="kaifang" v-if="kaifang == 0">
            <div class="zhenduan">
                <div class="title">诊断</div>
                <div>辨病：<input type="text" v-model="bingming"></div>
                <div>辨证：<input type="text" v-model="bingzheng"></div>
            </div>
            <p class="title">开方</p>
            <div class="pharmacy" @click="changeCoverCss('store', 'block')">
                <img :src="image_http +yaofang_logo" class="pharmacy_logo" alt="" v-if="yaofang_logo">
                <img src="../image/store.png" class="pharmacy_logo" alt="" v-else>
                <p class="pharmacy_name" v-if="yaofang_name">{{yaofang_name}}</p>
                <p class="pharmacy_name" v-else>请选择药房</p>
                <p class="subtitle">共有{{totalCount}}家药房可以选择</p>
                <img class="pharmacy_arrow" src="../image/arrow_right.png" alt="">
            </div>
            <div class="clear top-line"></div>
            <!-- 药材选择好了 -->
            <div class="RP_main" v-if="prescription">
                <div class="RP_main_item" v-for="item in prescription">{{item}}</div>
            </div>

            <!-- RP -->
            <div class="RP" v-show="yaofang_name" v-if="prescription == ''">
                <p class="title">RP :</p>
                <div class="add_btn" onclick="go_add_yaocai_win(0)">添加药材</div>
            </div>
            <div class="RP" v-else>
                <p class="title">RP :</p>
                <div class="add_btn" onclick="go_add_yaocai_win(1)">编辑药材</div>
            </div>
        </div>


        <!-- 用法 -->
        <div class="placeholder_div"></div>
        <div class="useing">

            <p class="title">用法用量</p>

            <div class="useing_method" onclick="select_useing_method()">
                <img class="useing_arrow" src="../image/arrow_right.png" alt="">
                <span>用药方法</span>
                <span>{{useing_method_on}}</span>
            </div>

            <div class="useing_detail">
                <span>共</span><input type="Number" v-model="usage_num"><span>帖</span>， <span>每日</span>
                <input type="Number" v-model="meiri_tieshu"><span>帖</span>，
                <span>一帖分</span><input type="Number" v-model="cishu"><span>次服用</span>
            </div>

            <!-- 医嘱 -->
            <div class="yizhu">
                医嘱：
                <input type="text" readonly class="openwin" data-win="yizhu_win" v-model="yizhu_content"
                    :data-content="yizhu_content" placeholder="请填写相关医嘱">
            </div>
        </div>
        <div class="placeholder_div"></div>


        <!-- 方案设置 -->
        <div class="fanganshezhi">
            <p class="title">方案设置</p>
            <div class="fanganshezhi_item" @click="changeCoverCss('bill_price','block')">
                <span class="zhenjin">诊金</span>
                <span class="price">￥{{zhenjin_on}}</span>
                <img class="fanganshezhi_arrow" src="../image/arrow_right.png" alt="">
            </div>

            <div class="fanganshezhi_item" @click="changeCoverCss('service_price','block')">
                <span class="zhenjin">服务费</span>
                <span class="price" v-if="service_money == 0">免费</span>
                <span class="price" v-else>￥{{service_money}}元</span>
                <img class="fanganshezhi_arrow" src="../image/arrow_right.png" alt="">
            </div>

            <div class="fanganshezhi_item" onclick="select_issee()">
                <span class="zhenjin">购药前处方是否可见</span>
                <span class="price">{{issee_on}}</span>
                <img class="fanganshezhi_arrow" src="../image/arrow_right.png" alt="">
            </div>
        </div>
        <div class="placeholder_div"></div>


        <!-- 总计 -->
        <div class="total">
            <p class="title" v-if="total_money">总计<span>￥{{total_money}}</span></p>
            <div class="item">诊金 <span>￥{{zhenjin_on}}</span></div>
            <div class="item">服务费总计 <span>{{service_money}} x {{usage_num}} = ￥{{totalServiceMoney}}</span></div>
            <div class="item">总药价 <span>{{toThreeDecimal(drugsPrice)}} x {{usage_num}} = ￥{{totalDrugsMoney}}</span>
            </div>
            <p>*患者不展示治疗服务费，治疗服务费直接计入在药费总额中</p>
            <p>*不含运费、代煎费，药费依据购药时实际选择的药房而定</p>
        </div>
        <div class="placeholder_div"></div>
        <!-- 确认选择患者按钮 -->
        <!-- <div class="order_btn p_hide" v-if="select_patient == '去选择患者'" @click="select_patient_btn">
            {{select_patient}}</div> -->
        <div class="order_btn p_hide" @click="queren">确认开方</div>



        <!-- 拍方  -->
        <div class="paifang" v-if="kaifang == 1">
            <div class="paifang_tips">
                <p class="paifang_tips_title">图片必须包含以下内容才可生成电子处方</p>
                <div class="paifang_tips_other">
                    <p>1、您上传处方照片，并进行方案设置</p>
                    <p>2、药房划价后，将通过大家中医消息提醒您</p>
                    <p>3、您需要确认方案，然后发送给患者</p>
                </div>
            </div>
            <div class="placeholder_div"></div>

            <!-- 拍方中的开方 -->
            <div class="kaifang">
                <p class="title">开方</p>

                <div class="pharmacy" @click="changeCoverCss('store','block')">
                    <img :src="image_http + yaofang_logo" class="pharmacy_logo" alt="" v-if="yaofang_logo">
                    <img src="../image/store.png" class="pharmacy_logo" alt="" v-else>
                    <p class="pharmacy_name" v-if="yaofang_name">{{yaofang_name}}</p>
                    <p class="pharmacy_name" v-else>请选择药房</p>
                    <p class="subtitle">共有{{totalCount}}家药房可以选择</p>
                    <img class="pharmacy_arrow" src="../image/arrow_right.png" alt="">
                </div>

                <!-- 拍照按钮 -->
                <img style="width: 3.75rem;height: 3.75rem;object-fit: scale-down;background-color: #ccc;"
                    :src="image_http + item" v-for="item in paifang_imgs" alt="">

                <img style="width: 3.75rem;height: 3.75rem;object-fit: scale-down;background-color: #ccc;"
                    src="../image/updata_img.png" v-if="paifang_imgs.length < 1" alt="" onclick="select_img()">

                <!-- 拍方的提示 -->
                <div class="paifang_tip" v-if="paifang_include == false" @click="paifang_include = true">
                    提示
                    <img src="../image/icon_arrow_bottom.png" alt="">
                </div>

                <!-- 拍方必须包含以下内容 -->
                <div class="paifang_include" v-if="paifang_include">
                    <p class="paifang_include_title">
                        拍方内容必须包含以下内容
                    </p>
                    <div class="paifang_include_main">
                        <img src="../image/paifang_example.png" class="paifang_include_main_left" alt="">
                        <div class="paifang_include_main_right">
                            <p class="paifang_include_main_right_title">患者信息</p>
                            <p class="paifang_include_main_right_info">姓名、性别、年龄</p>
                            <p class="paifang_include_main_right_title">处方信息</p>
                            <p class="paifang_include_main_right_info">辨病及辨证、药方、用法用量</p>
                        </div>

                        <div class="tips_div" v-if="paifang_include == true" @click="paifang_include = false">收起
                            <img src="../image/icon_arrow_top.png" alt="">
                        </div>
                    </div>
                </div>
            </div>

            <!-- 拍方中的方案设置 -->
            <div class="fanganshezhi">
                <p class="title">方案设置</p>
                <div class="fanganshezhi_item" @click="changeCoverCss('bill_price','block')">
                    <span class="zhenjin">诊金</span>
                    <span class="price">￥{{zhenjin_on}}</span>
                    <img class="fanganshezhi_arrow" src="../image/arrow_right.png" alt="">
                </div>

                <div class="fanganshezhi_item" onclick="select_issee()">
                    <span class="zhenjin">购药前处方是否可见</span>
                    <span class="price">{{issee_on}}</span>
                    <img class="fanganshezhi_arrow" src="../image/arrow_right.png" alt="">
                </div>

                <p>*患者不展示治疗服务费，治疗服务费直接计入在药费总额中</p>
                <p>*不含运费、代煎费，药费依据购药时实际选择的药房而定</p>
            </div>

            <!-- 确认选择患者按钮 -->
            <div class="order_btn p_hide" v-if="select_patient == '去选择患者'" @click="select_patient_btn">
                {{select_patient}}</div>
            <div class="order_btn p_hide" v-else @click="paifang">{{select_patient}}</div>
        </div>




        <!--  遮罩层 -->
        <div class="cover" :style="{display:coverCss.store}"></div>
        <div class="zhezhao_jixing_div" :style="{display:coverCss.store}">
            <div class="zhezhao_title">
                <span>选择剂型和药房</span>
                <span @click="changeCoverCss('store', 'none')">取消</span>
            </div>
            <div class="clear"></div>
            <div class="store-container">
                <div class="select_catalog">
                    <div v-for="(item,index) in jixing_list" @click="select_yaofang(item.id,item.name)"
                        onclick="qieTab(this)">
                        <span>{{item.name}}</span>
                    </div>
                </div>
                <div class="catalog-item-container">
                    <div class="tips">购药时可选是否代煎</div>
                    <div class="clear"></div>
                    <div class="select_catalog_item" v-for="item in yaofang_list">
                        <div class="logo"><img :src=" image_http + item.image" alt="" @click="yaowu_detail(item)"></div>
                        <div class="store-info">
                            <div class="store-name-wrap" @click="yaowu_detail(item)">
                                <span class="yaofang_name">{{item.name}}</span>
                                <span class="openwin" data-win="widget://html/pharmacy_detail_win.html"
                                    :data-id="item.id">详情</span>
                            </div>
                            <div class="clear"></div>
                            <div class="service-tips">
                                <div class="service-tags" v-for="items in item.storeSupportVos"
                                    v-if='items.keyName  != "areas"'>
                                    <span class="tips_item" v-if='items.keyName  != "areas"'>{{items.keyValue}}</span>
                                    <span class="tips_item" v-else>区域代煎</span>
                                </div>
                                <div class="clear"></div>
                                <div class="service-tags-view" v-for="items in item.storeSupportVos"
                                    v-if='items.keyName  == "areas"'>
                                    <div @click="quYu_show()" class="tips_daijian">查看代煎区域</div>
                                    <div class="tips_item" v-show='quyu_show'>
                                        <span v-for="(itemss,index) in items.keyValueList">{{itemss}}</span>
                                    </div>
                                </div>
                            </div>
                            <div class="clear"></div>
                            <div class="price" v-if="item.price">单帖:￥{{item.price}}</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div style="text-align: center;clear:both;font-size: 0.6rem;margin-top: 1rem;">已经没有更多了~</div>
                </div>
            </div>
        </div>
        <div class="cover" :style="{display:coverCss.bill_price}"></div>
        <div class="price_zhezhao_main" :style="{display:coverCss.bill_price}">
            <p class="price_title">诊金价格</p>
            <div class="price_div">
                <p class="price_div_item" v-for="(item,index) in zhenjin" @click="select_zhenjin(item)">
                    ￥{{item}}</p>

                <input type="Number" placeholder="自定义金额(元)" v-model="zidingyi_zhenjin">
            </div>

            <div class="btn_div">
                <span @click="changeCoverCss('bill_price','none')">取消</span>
                <span style="color: #2E8EFF;" @click="zhenjin_queren">确定</span>
            </div>
        </div>
        <div class="cover" :style="{display:coverCss.service_price}"></div>
        <div class="price_zhezhao_main" :style="{display:coverCss.service_price}">
            <p class="price_title">治疗服务费价格</p>
            <div class="price_div">
                <p class="price_div_item" @click="select_fuwu_price(0)">免费</p>
                <p class="price_div_item" v-for="(item,index) in serviceMoney"
                    @click="select_fuwu_price(item.servicePrice)">
                    <span v-if="item.servicePrice == 0">免费</span>
                    <span v-else>{{item.title}}</span>
                </p>
            </div>
            <div class="btn_div">
            </div>
        </div>
        <!-- 遮罩层-->
    </div>
</body>

</html>
<script src="../script/set_root.js"></script>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hb.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript">
    apiready = function () {
        hb_ready();
        get_zhenjin() // 服务费选项
        get_jixing_list() // 获取剂型列表
        // alert(JSON.stringify($api.getStorage("emp")))
        app.image_http = IMAGE_HTTP;
        // if (api.pageParam.index == 3) {
        //     get_ajax("user/view", {
        //         userId: api.pageParam.info.userId
        //     }, function (res, err) {
        //         if (res.code == 200) {
        //             app.patient_name = res.data.realname
        //             app.patient_age = res.data.age
        //             app.select_patient = "确认发出方案"
        //             app.select_patient_name = api.pageParam.info.realname
        //             app.select_patient_uid = api.pageParam.info.userId
        //         }
        //     })
        // }
        api.addEventListener({
            name: 'medicalAdvice'
        }, function (ret, err) {
            // console.log(JSON.stringify(ret))
            app.yizhu_content = ret.value.content
        });

        // 请求医生个人信息数据
        get_ajax("doctor/verify/view", {
            userId: $api.getStorage("emp").userId,
        }, function (res, err) {
            if (res.code == 2000) {
                app.doctorName = res.data.name
            }

        })

        // 上级页面传递过来的用户参数
        if (api.pageParam.userId) {
            get_ajax("ucenter/view", {
                userId: api.pageParam.userId
            }, function (res, err) {
                if (res.code == 2000) {
                    // alert(JSON.stringify(res))
                    app.user = res.data
                }
            })
        }

        // 接收win传过来的区分标识
        api.addEventListener({
            name: 'history_case'
        }, function (ret, err) {
            get_ajax("prescribe/plan/form", {
                id: ret.value.value
            }, function (res, err) {
                if (res.code == 200) {
                    app.select_patient_uid = res.data.userId
                    app.patient_name = res.data.name
                    app.sex = res.data.sex
                    app.patient_age = res.data.age
                    app.bingming = res.data.diseases
                    app.bingzheng = res.data.dialectical
                    app.yaofang_id = res.data.storeId
                    app.yaofang_name = res.data.store
                    app.yaofang_logo = res.data.storeLogo
                    app.dosage_form_id = res.data.dosageFormId
                    app.dosage_form_name = res.data.dosageForm
                    app.usage_num = res.data.quantity
                    app.useing_method = res.data.usages
                    app.meiri_tieshu = res.data.usageNum
                    app.cishu = res.data.times
                    app.yizhu_content = res.data.medicalAdvice
                    app.visible = res.data.visible
                    app.zhenjin_on = res.data.billingMoney
                    app.service_money = res.data.serviceMoney
                    app.total_money = res.data.totalMoney
                    app.treatmentDrugs = res.data.prescribeDrugs
                    app.prescription.length = 0
                    app.drugsPrice = 0
                    for (i in app.treatmentDrugs) {
                        var item = app.treatmentDrugs[i].name + app.treatmentDrugs[i].quantity +
                            app.treatmentDrugs[i].unit
                        app.prescription.push(item)
                        app.drugsPrice += (Number(app.treatmentDrugs[i].salePrice) * Number(app
                            .treatmentDrugs[i].quantity));
                    }
                    app.totalDrugsMoney = $api.toThreeDecimal(app.drugsPrice * app.usage_num);
                    moren_jine(); //单贴药价对应的服务费
                    //统计总服务费
                    app.totalServiceMoney = Math.round(Number(app.usage_num * app.service_money))
                    if (!res.data.prescribeDrugs) {
                        app.prescription = []
                    }
                }
            })
            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });

        // 接收win传过来的区分标识
        api.addEventListener({
            name: 'kaifang_tab'
        }, function (ret, err) {
            app.kaifang = ret.value.val
            // alert(ret.value.val)
            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });

        // 接收药材数据
        api.addEventListener({
            name: 'save_yaocai'
        }, function (ret, err) {
            app.treatmentDrugs = ret.value.total_yaocai
            app.prescription.length = 0
            app.drugsPrice = 0
            for (i in app.treatmentDrugs) {
                var item = app.treatmentDrugs[i].name + app.treatmentDrugs[i].quantity + app.treatmentDrugs[
                    i].unit
                app.prescription.push(item)
                app.drugsPrice += (Number(app.treatmentDrugs[i].salePrice) * Number(app.treatmentDrugs[i]
                    .quantity));
            }
            app.totalDrugsMoney = $api.toThreeDecimal(app.drugsPrice * app.usage_num);
            if (!ret.value.total_yaocai) {
                app.prescription = []
            }
            moren_jine()
            app.totalServiceMoney = Math.round(app.service_money * app.usage_num);
        });

        // 接收医嘱页面传出来的医嘱
        api.addEventListener({
            name: 'chuandi_yizhu'
        }, function (ret, err) {
            app.yizhu_content = ret.value.content

            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });

        // 接受拍方去选择的患者uid，名称
        api.addEventListener({
            name: 'select_patient_on'
        }, function (ret, err) {
            // alert(JSON.stringify(ret.value));
            app.select_patient_name = ret.value.name
            app.select_patient_uid = ret.value.uid
            app.select_patient = "确认并生成方案"
        });
        app.totalServiceMoney = Math.round(app.service_money * app.usage_num);
        app.total_money = app.zhenjin_on + app.totalServiceMoney + (app.drugsPrice * app.usage_num)
        app.total_money = $api.toThreeDecimal(app.total_money)
    }
    //使用vue对数据进行绑定
    var app = new Vue({
        el: '#app',
        data: {
            doctorName: "", // 医生姓名
            user: "", // 患者信息
            yaofang_id: "",
            image_http: "",
            jixing: "", // 选择药房之后展示的剂型
            yaofang_name: "",
            yaofang_logo: "",
            kaifang: 0,
            page: 1,
            coverCss: {
                store: "none",
                service_price: "none",
                bill_price: "none",
                order_success: "none",
                paifang_bill_price: "none"
            },
            useing_method_on: "内服", // 用药方法
            useing_method_btns: ["内服", "外用"],
            useing_method: 1, // 用药方法 1=内服 2=外用
            issee_on: "可见",
            issee: ['不可见', '可见'],
            zhenjin_on: 0, // 页面上的诊金
            zhenjin: ['0', '50', '100', '200'],
            zidingyi_zhenjin: "", // 弹出层中的输入框的自定义诊金
            yizhu_content: "", //医嘱内容
            sex: 1,
            sex_on: "男",
            sex_btns: ["男", "女"],
            patient_name: "", // 患者姓名
            patient_age: "", // 患者年龄
            bingming: "", // 病名
            bingzheng: "", // 病症
            dosage_form_id: "0", // 剂型id
            dosage_form_name: "", // 剂型名称
            prescription: [], // 处方药材
            treatmentDrugs: [],
            usage_detail: "", // 用法详述，在created方法中定义
            usage_num: 1, // 用量数，默认1
            meiri_tieshu: 1, // 每日多少帖
            cishu: 2, // 一帖多少次
            visible: 1, // 购药前处方是否可见  1可见  0不可见
            serviceMoney: [], // 服务费数组
            service_money: "0", // 服务费
            totalServiceMoney: 0.00, //治疗服务费总数
            totalDrugsMoney: 0.000, // 总药价
            total_money: 0.000, // 合计金额 前端不传后台计算出来的
            status: "0", // 0 待购药  1 已购药
            remark: "", //备注
            quyu_show: false,
            jixing_list: [], // 剂型列表
            yaofang_list: [], // 药房列表
            paifang_imgs: [], // 拍方的照片
            select_patient: "去选择患者", // 去选择患者按钮
            select_patient_name: "", // 拍方选择的患者名称
            select_patient_uid: "", // 拍方选择的患者uid
            drugsPrice: 0, // 单贴全部药价
            totalCount: 0, //药房数量
            quyu_show: false, //代煎区域显示
            paifang_include: false,
            select_yaofang_index: 0,
            select_yaofang_yaocai: [],
        },
        methods: {

            toThreeDecimal: function (val) {
                return $api.toThreeDecimal(val)
            },
            // 选择药房
            select_yaofang: function (id, name) {
                if (app.select_yaofang_index == 0) {
                    get_ajax("doctor/store/list/page/dosage", {
                        start: 1,
                        pagesize: 2,
                        dosageId: id,
                    }, function (res, err) {
                        // alert(id)
                        // alert(JSON.stringify(res))
                        // alert(JSON.stringify(err))
                        if (res.code == 2000) {
                            if (typeof res.data.data == undefined) {
                                app.yaofang_list = []
                            } else {
                                app.yaofang_list = res.data.data
                                app.dosage_form_id = id
                                app.dosage_form_name = name
                                app.totalCount = res.data.totalCount
                                app.$nextTick(function () {
                                    hb_init_openwinby_click();
                                })
                            }
                        } else {
                            toast("没有药房！")
                        }
                        // if (err) {
                        //   alert(JSON.stringify(err));
                        //     alert("网络不通畅，请稍后再试！")
                        // }
                    })
                } else {
                    app.select_yaofang_yaocai.length = 0
                    for (var i = 0; i < app.treatmentDrugs.length; i++) {
                        var item = {
                            id: app.treatmentDrugs[i].drugsId,
                            storeId: app.treatmentDrugs[i].storeId,
                            quantity: app.treatmentDrugs[i].quantity
                        }
                        app.select_yaofang_yaocai.push(item)
                    }
                    // alert(JSON.stringify(app.select_yaofang_yaocai))
                    post_ajax("store/service/page-price-list", {
                        start: app.page,
                        pagesize: 10,
                        typeId: String(id),
                        storeId: app.yaofang_id,
                        storeDrugsDtos: app.treatmentDrugs,
                    }, function (res, err) {
                        // alert(JSON.stringify(res))
                        if (res.code == 200) {
                            if (typeof res.data.data == undefined) {
                                app.yaofang_list = []
                            } else {
                                // alert(JSON.stringify(res.data.data))
                                app.yaofang_list = res.data.data
                                app.dosage_form_id = id
                                app.dosage_form_name = name
                                app.totalCount = res.data.totalCount
                                app.$nextTick(function () {
                                    hb_init_openwinby_click();
                                })
                            }
                        } else {
                            toast("没有药房！")
                            return;
                        }
                        // if (err) {
                        //     alert("网络不通畅，请稍后再试！")
                        // }
                    })
                }

            },
            // 遮罩层中选择诊金
            select_zhenjin: function (price) {
                this.zhenjin_on = price
                this.coverCss.bill_price = "none"
                app.$nextTick(function () {
                    hb_init_openwinby_click();
                })
            },

            // 遮罩层中选择服务费
            select_fuwu_price: function (price) {
                // alert(price)
                this.service_money = price
                this.coverCss.service_price = "none"

                app.$nextTick(function () {
                    hb_init_openwinby_click();
                })
            },
            zhenjin_queren: function () {
                if (this.zidingyi_zhenjin) {
                    this.zhenjin_on = this.zidingyi_zhenjin
                    this.coverCss.bill_price = "none"
                    app.$nextTick(function () {
                        hb_init_openwinby_click();
                    })
                } else {
                    toast("请选择或输入诊金价格")
                }
            },
            // 确认新增开方
            queren: function () {
                if (!this.bingming) {
                    toast("请输入辨病")
                    return;
                }
                if (!this.bingzheng) {
                    toast("请输入辩证")
                    return;
                }
                if (this.prescription.length == 0) {
                    toast("请输入处方药材")
                    return;
                }
                if (!this.usage_num) {
                    toast("请输入用量数")
                    return;
                }
                if (!this.yaofang_id) {
                    toast("请选择药房")
                    return;
                }
                if (!this.meiri_tieshu) {
                    toast("请输入每日使用多少帖")
                    return;
                }
                if (!this.cishu) {
                    toast("请输入每一帖使用多少次数")
                    return;
                }
                if (!this.yizhu_content) {
                    toast("请输入相关医嘱")
                    return;
                }
                var a = {
                    doctorId: String($api.getStorage("emp").userId), // 医生账号id
                    doctor: $api.getStorage("emp").realname, // 医生姓名
                    userId: String(app.select_patient_uid), // 选择的患者id
                    name: String(app.patient_name), // 患者姓名
                    sex: String(app.sex), // 患者性别
                    age: String(app.patient_age), // 患者年龄
                    diseases: String(app.bingming), // 病名
                    dialectical: String(app.bingzheng), // 病症
                    storeId: app.yaofang_id, // 药房id
                    store: String(app.yaofang_name), // 药房名称
                    source: "online",
                    storeLogo: String(app.yaofang_logo), // 药房logo
                    dosageFormId: String(app.dosage_form_id), // 剂型id
                    dosageForm: String(app.dosage_form_name),
                    prescription: String(app.prescription), // 处方药材
                    usages: String(app.useing_method), //用药方法
                    quantity: String(app.usage_num), // 总量多少帖
                    usageNum: String(app.meiri_tieshu), // 每日多少帖
                    times: String(app.cishu), // 一贴分多少次服用
                    usageDetail: String(app.usage_detail), // 用法详述
                    medicalAdvice: String(app.yizhu_content), //医嘱
                    visible: String(app.visible), // 购药前处方是否可见
                    billingMoney: String(app.zhenjin_on), // 诊费诊金
                    serviceMoney: String(app.service_money), // 服务费
                    drugMoney: String(app.drugsPrice), // 药价
                    totalMoney: String(app.total_money), // 合计金额
                    remark: String(app.remark) ? String(app.remark) : '无备注', // 备注
                    prescribeDrugs: app.treatmentDrugs, // 处方药材
                };
                var data = {
                    doctorId: String($api.getStorage("emp").userId), // 医生账号id
                    doctorName: app.doctorName, // 医生姓名
                    patientId: api.pageParam.id, // 档案id
                    userId: api.pageParam.userId, // 选择的患者id
                    userName: String(app.user.realname), // 患者姓名
                    sex: String(app.user.sex), // 患者性别
                    age: 22, // 患者年龄
                    diseases: String(app.bingming), // 病名
                    dialectical: String(app.bingzheng), // 病症
                    storeId: app.yaofang_id, // 药房id
                    storeName: String(app.yaofang_name), // 药房名称
                    storeLogo: String(app.yaofang_logo), // 药房logo
                    dosageFormId: String(app.dosage_form_id), // 剂型id
                    dosageForm: String(app.dosage_form_name),
                    prescription: String(app.prescription), // 处方药材
                    administrationRoute: String(app.useing_method), //用药方法
                    dailyDose: String(app.usage_num), // 总量多少帖
                    usageNum: String(app.meiri_tieshu), // 每日多少帖
                    times: String(app.cishu), // 一贴分多少次服用
                    medicalAdvice: String(app.yizhu_content), //医嘱
                    visible: String(app.visible), // 购药前处方是否可见
                    billingMoney: String(app.zhenjin_on), // 诊费诊金
                    serviceMoney: String(app.service_money), // 服务费
                    drugMoney: String(app.drugsPrice), // 药价
                    remark: String(app.remark) ? String(app.remark) : '无备注', // 备注
                    prescribeDrugs: app.treatmentDrugs, // 处方药材
                    source: "online",
                }
                post_ajax("doctor/prescribe/save", {
                    data
                }, function (res, err) {
                    console.log(JSON.stringify(data))
                    console.log(JSON.stringify(res))
                    console.log(JSON.stringify(err))
                    // alert("开方成功")

                    // api.closeWin()
                })
            },
            changeCoverCss: function (val, css) {
                if (val == "store") {
                    app.coverCss.store = css;
                } else if (val == "service_price") {
                    app.coverCss.service_price = css;
                } else if (val == "bill_price") {
                    app.coverCss.bill_price = css;
                } else if (val == "order_success") {
                    app.coverCss.bill_price = css;
                } else if (val == "paifang_bill_price") {
                    app.coverCss.paifang_bill_price = css;
                }
            },
            select_patient_btn: function () {
                moren_jine()
                api.openWin({
                    name: "my_patient_win",
                    url: "my_patient_win.html",
                    pageParam: {
                        select_patient: true
                    }
                })
            },

            // 药品详情
            yaowu_detail: function (item) {
                app.yaofang_id = String(item.id)
                app.yaofang_name = item.name
                if (item.image) {
                    app.yaofang_logo = item.image.replace(app.image_http, "")
                }
                app.coverCss.store = "none"
            },
            // 代煎区域显示
            quYu_show: function () {
                app.quyu_show = true
            },
        },
        watch: {
            prescription: function (val) {
                if (val) {
                    app.select_yaofang_index = 1
                } else {
                    app.select_yaofang_index = 0
                }
            },
            coverCss: function (val) {
                if (val) {
                    $("body").css('overflow', 'hidden')
                } else {
                    $("body").css('overflow', 'visible');
                }

                app.$nextTick(function () {
                    hb_init_openwinby_click();
                })
            },

            // bug影响调用历史记录
            zhenjin_on: function (val) {
                this.total_money = Number(this.zhenjin_on) + Number(this.totalDrugsMoney) + Number(this
                    .totalServiceMoney)
                this.total_money = $api.toThreeDecimal(this.total_money)
            },
            service_money: function (val) {
                this.totalServiceMoney = Math.round(Number(this.service_money) * Number(this.usage_num))
                this.total_money = Number(this.zhenjin_on) + Number(this.totalDrugsMoney) + Number(this
                    .totalServiceMoney)
                this.total_money = $api.toThreeDecimal(this.total_money)
            },
            drugsPrice: function (val) {
                this.total_money = Number(this.zhenjin_on) + Number(this.totalDrugsMoney) + Number(this
                    .totalServiceMoney)
                this.total_money = $api.toThreeDecimal(this.total_money)
            },
            usage_num: function (val) {
                this.totalDrugsMoney = $api.toThreeDecimal(Number(this.drugsPrice) * Number(this.usage_num))
                this.totalServiceMoney = Math.round(Number(this.usage_num) * Number(this.service_money))
                this.total_money = Number(this.zhenjin_on) + Number(this.totalServiceMoney) + (Number(this
                    .drugsPrice) * Number(this.usage_num))
                this.total_money = $api.toThreeDecimal(this.total_money)
                this.usage_detail = "共" + val + "帖，每日" + this.meiri_tieshu + "帖，一贴分" + this.cishu +
                    "次服用" // 定义用法详述
            },

            meiri_tieshu: function (val) {
                this.usage_detail = "共" + this.usage_num + "帖，每日" + val + "帖，一贴分" + this.cishu +
                    "次服用" // 定义用法详述
            },
            cishu: function (val) {
                this.usage_detail = "共" + this.usage_num + "帖，每日" + this.meiri_tieshu + "帖，一贴分" + val +
                    "次服用" // 定义用法详述
            }
        },
    })

    // 选择性别
    function select_sex() {
        api.actionSheet({
            title: '请选择患者性别',
            cancelTitle: '取消',
            buttons: app.sex_btns
        }, function (ret, err) {
            var index = ret.buttonIndex; //下标从1开始
            if (index == 3) {
                return
            }
            app.sex = index;
            for (var i = 0; i < app.sex_btns.length; i++) {
                if (index - 1 == i) {
                    app.sex_on = app.sex_btns[i]
                }
            }
            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });
    }

    // 选择用药方法
    function select_useing_method() {
        api.actionSheet({
            title: '选择用药方法',
            cancelTitle: '取消',
            buttons: app.useing_method_btns
        }, function (ret, err) {
            var index = ret.buttonIndex; //下标从1开始
            if (index == 3) {
                return
            }
            app.useing_method = index
            for (var i = 0; i < app.useing_method_btns.length; i++) {
                if (index - 1 == i) {
                    app.useing_method_on = app.useing_method_btns[i]
                }
            }
            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });
    }

    // 选择是否可见
    function select_issee() {
        api.actionSheet({
            title: '请选择是否可见',
            cancelTitle: '取消',
            buttons: app.issee
        }, function (ret, err) {
            var index = ret.buttonIndex; //下标从1开始
            if (index == 3) {
                return
            }
            app.visible = index - 1
            for (var i = 0; i < app.issee.length; i++) {
                if (index - 1 == i) {
                    app.issee_on = app.issee[i]
                }
            }
            app.$nextTick(function () {
                hb_init_openwinby_click();
            })
        });
    }

    // 获取剂型列表
    function get_jixing_list() {
        get_ajax("doctor/dosageform/list", {}, function (res, err) {
            if (res.code == 2000) {
                app.jixing_list = res.data
            } else {
                toast(JSON.stringify(res.msg))
            }

            // if (err) {
            //     alert("网络不通畅，请稍后再试！")
            // }
        })
    }

    // 剂型的切换
    function qieTab(obj) {
        $('.tab_active').removeClass('tab_active');
        $(obj).addClass('tab_active')
    }

    // 去到添加药材
    function go_add_yaocai_win(index) {
        api.openWin({
            name: "add_yaocai_win",
            url: "add_yaocai_win.html",
            pageParam: {
                id: app.yaofang_id,
                title: app.yaofang_name,
                total_yaocai: app.treatmentDrugs,
                index: index,
            }
        })
        app.select_yaofang_index = index
    }

    function get_zhenjin() {
        get_ajax("doctor/service-price", {
            doctorUserId: $api.getStorage("emp").userId
        }, function (res, err) {
            if (res) {
                // alert(JSON.stringify(res))
                app.serviceMoney = res.data
            }
        })
    }

    function moren_jine() {
        get_ajax("doctor/default-service-price", {
            doctorUserId: $api.getStorage("emp").userId,
            drugsPrice: String(app.drugsPrice)
        }, function (res, err) {
            if (res.code == 200) {
                // alert(JSON.stringify(res))
                app.service_money = res.data
            }
        })
    }
</script>